Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: module consensus version is not correctly set when upgrade after state sync #389

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

forcodedancing
Copy link
Collaborator

@forcodedancing forcodedancing commented Jan 22, 2024

Description

Fix upgrade initializers are not called when state sync.

Rationale

If pre initializers are not called, it will lead to apphash mismatch issue. For example,

When doing migration, the to version (will be stored) is read from app.

toVersion := uint64(0)
if module, ok := module.(HasConsensusVersion); ok {
	toVersion = module.ConsensusVersion()
}
...

updatedVM[moduleName] = toVersion

However, when doing state sync, it will not call all previous upgrade initializers, leading to toVersion is not correct.

Example

NA

Changes

Notable changes:

  • upgrade handler

Potential Impacts

@forcodedancing forcodedancing changed the title fix: module consensus version is not correctly set when upgrade after… fix: module consensus version is not correctly set when upgrade after state sync Jan 22, 2024
@unclezoro unclezoro added this pull request to the merge queue Jan 22, 2024
Merged via the queue into bnb-chain:develop with commit fecf600 Jan 22, 2024
15 checks passed
@forcodedancing
Copy link
Collaborator Author

forcodedancing commented Jan 22, 2024

Before fix:
image
After fix:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants